#!/usr/bin/env python
#-*-encoding:utf-8-*-
'''
Created on 2015年1月31日

@author: chenyongbing
'''
import sys,os
current_dir = os.path.dirname(__file__)
sys.path.append(os.path.join(current_dir,'../'))
from base.PyMySQL import ConnectMySQL
from base.localConfig import baseLocalConfig


retail_host = baseLocalConfig.mysqlConfig['retail']['host']
retail_port = baseLocalConfig.mysqlConfig['retail']['port']
retail_user = baseLocalConfig.mysqlConfig['retail']['user']
retail_passwd = baseLocalConfig.mysqlConfig['retail']['passwd']
retail_db = baseLocalConfig.mysqlConfig['retail']['db']
myRetail = ConnectMySQL(host=retail_host, user=retail_user, password=retail_passwd, db=retail_db)

class AnalyzeGroupFromTab(object):
    '''
    classdocs
    '''


    def __init__(self):
        '''
        Constructor
        '''
        
    def get_group_and_name_list(self):
        datas = []
        query = 'select g.id,g.name,c.name from groups g,companies c where g.type=4 and g.company_id=c.id order by c.name'
        ret = myRetail.SelectAll(query)
        if ret==None:return datas
        for gid,gname,cname in ret:
            datas.append([gid,'%s:%s'%(cname,gname)])
        return datas
        
if __name__ == '__main__':
    pass